# Maintainer: David Runge <dvzrv@archlinux.org>

_name=filesystem
pkgname=ghc-filesystem
pkgver=1.5.14
pkgrel=1
pkgdesc="An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20"
arch=(any)
url="https://github.com/gulrak/filesystem"
license=(MIT)
makedepends=(cmake)
source=($url/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('6eae921485ecdaf4b8329a568b1f4f612ee491fc5fdeafce9c8000b9bf1a73b6fa4e07d0d4ddf05be49efe79e9bddfbcc0aba85529cb016668797a8d89eb9b82')
b2sums=('9734907da65e0f390e461d76c7b1c7e8ffa1a0f7f01e5952d69d9d6b6cc3c85e20f5e4495235f2589635fb665040bf2ee4def4d3bdcb0f3453a00ee8c4e8ac3f')

build() {
  local cmake_options=(
    -B build
    -S $_name-$pkgver
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX=/usr
    -Wno-dev
  )
  cmake "${cmake_options[@]}"
  cmake --build build
}

check() {
  ctest --output-on-failure --test-dir build/test
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $_name-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 $_name-$pkgver/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
